package controle;

import gui.Gui;

import java.net.ServerSocket;
import java.net.Socket;

public class ClienteBroadcastListener extends Thread {
	
	private ServerSocket serversocket;
	private Gui gui;
	
	public ClienteBroadcastListener(Gui gui)
	{
		this.gui	=	gui;
	}

	public void run()
	{
		try
		{
			this.serversocket	= new ServerSocket(SocketControlConstants.portaServidorClienteBroadcast);
			
			while(true)
			{
				Socket conexao	=	this.serversocket.accept();
				
				ClienteBroadcastHandler clienteBroadcastHandler = new ClienteBroadcastHandler(conexao,this.gui);
				
				clienteBroadcastHandler.start();
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
	}
}
